﻿using System.Web;
using Easy.BLL;
using Easy.Operation;

namespace Easy.Web.Service.Data
{
    /// <summary>
    /// SaveFormData 的摘要说明
    /// </summary>
    public class SaveFormData : BaseHttpHandler
    {
       
        public override void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string data = context.Request["data"];

            string entityName = context.Request["entityname"];

            string Id = context.Request["id"];


            DataService service = new DataService(entityName, this.CurrentUserId);

            string saveid = "";


            if (Id != null && Id != "")
            {
                saveid = service.Update(data);
            }
            else
            {
                saveid = service.Create(data);
            }


            context.Response.Write(saveid);
        }
    }
}